<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/9/20
 * Time: 10:31
 */
header("Content-type:text/html;charset=utf-8");
$mobile = $_POST['m'];
$len = strlen($mobile);
var_dump($len);
$mobile = trim($mobile);//去除首尾空隔，ltrim,rtrim
if (strlen($mobile) == 11){
    $s = substr($mobile,3,4);
    var_dump($s);
    $r2 = str_replace($s,"****",$mobile);
    var_dump($r2);
} else {
    echo "号码位数不对";
}